<extend name="./public/frame.html"/>
<block name="content">
    <form class="layui-form" autocomplete="off" id="formId">
        <input type="hidden" name="driver_id" value="{$info.driver_id}"/>
        <table class="layui-table">
            <tr>
                <td style="width:12%;text-align: center;">*性别</td>
                <td>
                    <div class="layui-input-block">
                        <input type="radio" name="sex" value="1" title="男" checked>
                    <input type="radio" name="sex" value="2" title="女" <if condition="$info['sex'] eq 2">checked</if>>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align: center;">*出生日期</td>
                <td><input type="text" name="birthday" id="birthday" class="layui-input" lay-verify="required" value="{$info['birthday']}"></td>
            </tr>
            <tr>
                <td style="text-align: center;">*民族</td>
                <td>
                    <div class="layui-input-block">
                        <input type="radio" name="nationality" value="1" title="汉族" checked>
                        <input type="radio" name="nationality" value="2" title="蒙古族" <if condition="$info['nationality'] eq 2">checked</if>>
                        <input type="radio" name="nationality" value="3" title="回族" <if condition="$info['nationality'] eq 3">checked</if>>
                        <input type="radio" name="nationality" value="4" title="藏族" <if condition="$info['nationality'] eq 4">checked</if>>
                        <input type="radio" name="nationality" value="5" title="维吾尔族" <if condition="$info['nationality'] eq 5">checked</if>>
                        <input type="radio" name="nationality" value="6" title="苗族" <if condition="$info['nationality'] eq 6">checked</if>>
                        <input type="radio" name="nationality" value="7" title="彝族" <if condition="$info['nationality'] eq 7">checked</if>>
                        <input type="radio" name="nationality" value="8" title="壮族" <if condition="$info['nationality'] eq 8">checked</if>>
                        <input type="radio" name="nationality" value="9" title="布依族" <if condition="$info['nationality'] eq 9">checked</if>>
                        <input type="radio" name="nationality" value="10" title="朝鲜族" <if condition="$info['nationality'] eq 10">checked</if>>
                        <input type="radio" name="nationality" value="57" title="其他" <if condition="$info['nationality'] eq 57">checked</if>>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="width:12%;text-align: center;">*婚姻状况</td>
                <td>
                    <div class="layui-input-block">
                        <input type="radio" name="is_merry" value="10" title="未婚" checked>
                        <input type="radio" name="is_merry" value="20" title="已婚" <if condition="$info['is_merry'] eq 20">checked</if>>
                        <input type="radio" name="is_merry" value="30" title="离婚" <if condition="$info['is_merry'] eq 30">checked</if>>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="width:12%;text-align: center;">*外语能力</td>
                <td>
                    <div class="layui-input-block">
                        <input type="radio" name="language_level_enum" value="4" title="一般" checked>
                        <input type="radio" name="language_level_enum" value="3" title="良好" <if condition="$info['language_level_enum'] eq 3">checked</if>>
                        <input type="radio" name="language_level_enum" value="2" title="熟练" <if condition="$info['language_level_enum'] eq 2">checked</if>>
                        <input type="radio" name="language_level_enum" value="1" title="精通" <if condition="$info['language_level_enum'] eq 1">checked</if>>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="width:12%;text-align: center;">*学历</td>
                <td>
                    <div class="layui-input-block">
                        <input type="radio" name="education_enum" value="81" title="小学毕业" checked>
                        <input type="radio" name="education_enum" value="71" title="初中毕业" <if condition="$info['education_enum'] eq 71">checked</if>>
                        <input type="radio" name="education_enum" value="61" title="普通高中毕业" <if condition="$info['education_enum'] eq 61">checked</if>>
                        <input type="radio" name="education_enum" value="41" title="中等专科毕业" <if condition="$info['education_enum'] eq 41">checked</if>>
                        <input type="radio" name="education_enum" value="31" title="大学专科" <if condition="$info['education_enum'] eq 31">checked</if>>
                        <input type="radio" name="education_enum" value="21" title="大学本科" <if condition="$info['education_enum'] eq 21">checked</if>>
                        <input type="radio" name="education_enum" value="17" title="研究生" <if condition="$info['education_enum'] eq 17">checked</if>>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align: center;">*户口登记机关名称</td>
                <td><input type="text" name="household_issue_authority" id="household_issue_authority" class="layui-input" lay-verify="required" value="{$info['household_issue_authority']}"></td>
            </tr>
            <tr>
                <td style="text-align: center;">*通信地址</td>
                <td><input type="text" name="mailing_address" id="mailing_address" class="layui-input" lay-verify="required" value="{$info['mailing_address']}"></td>
            </tr>
            <tr>
                <td style="text-align: center;">*户口住址或常住地址</td>
                <td><input type="text" name="permanent_address" id="permanent_address" class="layui-input" lay-verify="required" value="{$info['permanent_address']}"></td>
            </tr>
            <tr>
                <td style="text-align: center;">*准驾车型</td>
                <td><input type="text" name="allow_model" id="allow_model" class="layui-input" lay-filter="required" value="{$info['allow_model']}"></td>
            </tr>
            <tr class="taxi">
                <td style="text-align: center;">*初次领取日期</td>
                <td><input type="text" name="first_receive_license_date" id="first_receive_license_date" class="layui-input" value="{$info['first_receive_license_date'] == 0?'':$info['first_receive_license_date']}" lay-verify="required"></td>
            </tr>
            <tr>
                <td style="text-align: center;">*交通违章次数</td>
                <td><input type="text" name="traffic_violation_times" id="traffic_violation_times" class="layui-input" lay-filter="required|number" onkeyup="value=value.replace(/[^\d]+/g,'')" value="{$info['traffic_violation_times']}"></td>
            </tr>
            <tr class="taxi">
                <td style="text-align: center;">*签约公司</td>
                <td><input type="text" name="sign_company" id="sign_company" class="layui-input" value="{$info['sign_company'] == ''?'':$info['sign_company']}" lay-verify="required"></td>
            </tr>
            <tr>
                <td style="text-align: center;">*合同（或协议）有效期起</td>
                <td><input type="text" name="contract_valid_start" id="contract_valid_start" class="layui-input" lay-verify="required" value="{$info['contract_valid_start']}"></td>
            </tr>
            <tr>
                <td style="text-align: center;">*合同（或协议）有效期止</td>
                <td><input type="text" name="contract_valid_end" id="contract_valid_end" class="layui-input" lay-verify="required" value="{$info['contract_valid_end']}"></td>
            </tr>
            <tr>
                <td style="text-align: center;">*服务类型</td>
                <td>
                    <div class="layui-input-block" id="service_type">
                        <input type="radio" lay-filter="type" name="service_type" value="1" title="私人小客车合乘" <if condition="$info['service_type'] eq 1"> checked</if>>
                        <input type="radio" lay-filter="type" name="service_type" value="2" title="巡游出租汽车" <if condition="$info['service_type'] eq 2"> checked</if>>
                        <input type="radio" lay-filter="type" name="service_type" value="3" title="网络预约出租汽车" <if condition="$info['service_type'] eq 3"> checked</if>>
                        <!--<input type="radio" lay-filter="type" name="service_type" value="4" title="test"  checked="checked" >-->
                    </div>
                </td>
            </tr>

            <tr class="taxi">
                <td style="text-align: center;">*网络预约出租汽车驾驶证资格号</td>
                <td><input type="text" name="qualifications_number" id="qualifications_number" class="layui-input" value="{$info['qualifications_number'] == ''?'':$info['qualifications_number']}" lay-verify="required"></td>
            </tr>
            <tr class="taxi">
                <td style="text-align: center;">*网络预约出租汽车驾驶证发证机构(全称)</td>
                <td><input type="text" name="issue_agency" id="issue_agency" class="layui-input" lay-verify="required" value="{$info['issue_agency']}"></td>
            </tr>
            <tr class="taxi">
                <td style="text-align: center;">*资格证发证日期</td>
                <td><input type="text" name="issue_date" id="issue_date" class="layui-input" value="{$info['issue_date'] == 0?'':$info['issue_date']}" lay-verify="required"></td>
            </tr>
            <tr class="taxi">
                <td style="text-align: center;">*初次领取资格证日期</td>
                <td><input type="text" name="first_receive_date" id="first_receive_date" class="layui-input" value="{$info['first_receive_date'] == 0?'':$info['first_receive_date']}" lay-verify="required"></td>
            </tr>
            <tr class="taxi">
                <td style="text-align: center;">*资格证有效起始日期</td>
                <td><input type="text" name="certificate_valid_start" id="certificate_valid_start" class="layui-input" value="{$info['certificate_valid_start'] == 0?'':$info['certificate_valid_start']}" lay-verify="required"></td>
            </tr>
            <tr class="taxi">
                <td style="text-align: center;">*资格证有效截止日期</td>
                <td><input type="text" name="certificate_valid_end" id="certificate_valid_end" class="layui-input" value="{$info['certificate_valid_end'] == 0?'':$info['certificate_valid_end']}" lay-verify="required"></td>
            </tr>
            <tr class="taxi">
                <td style="text-align: center;">*报备日期</td>
                <td><input type="text" name="register_date" id="register_date"  class="layui-input" value="{$info['register_date'] == 0?'':$info['register_date']}" lay-verify="required"></td>
            </tr>
            <tr>
                <td style="text-align: center;">*经营范围</td>
                <td>
                    <div class="layui-input-block" id="wyc_service_type_enum">
                        <input type="radio" lay-filter="type" name="wyc_service_type_enum" value="1" title="私人小客车合乘" <if condition="$info['wyc_service_type_enum'] eq 1"> checked</if>>
                        <input type="radio" lay-filter="type" name="wyc_service_type_enum" value="2" title="巡游出租汽车" <if condition="$info['wyc_service_type_enum'] eq 2"> checked</if>>
                        <input type="radio" lay-filter="type" name="wyc_service_type_enum" value="3" title="网络预约出租汽车" <if condition="$info['wyc_service_type_enum'] eq 3"> checked</if>>
                        <!--<input type="radio" lay-filter="type" name="service_type" value="4" title="test"  checked="checked" >-->
                    </div>
                </td>
            </tr>
            <tr>
                <td style="width:12%;text-align: center;">*是否巡游驾驶员</td>
                <td>
                    <div class="layui-input-block">
                        <input type="radio" name="wyc_is_taxi_driver_enum" value="0" title="否" checked>
                        <input type="radio" name="wyc_is_taxi_driver_enum" value="1" title="是" <if condition="$info['wyc_is_taxi_driver_enum'] eq 1">checked</if>>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="width:12%;text-align: center;">*是否专职驾驶员</td>
                <td>
                    <div class="layui-input-block">
                        <input type="radio" name="wyc_is_full_time_enum" value="0" title="否" checked>
                        <input type="radio" name="wyc_is_full_time_enum" value="1" title="是" <if condition="$info['wyc_is_full_time_enum'] eq 1">checked</if>>
                    </div>
                </td>
            </tr>
            <tr class="taxi">
                <td style="text-align: center;">*联系人姓名</td>
                <td><input type="text" name="lxr_name" id="lxr_name" class="layui-input" value="{$info['lxr_name'] == ''?'':$info['lxr_name']}" lay-verify="required"></td>
            </tr>
            <tr class="taxi">
                <td style="text-align: center;">*联系人手机号</td>
                <td><input type="text" name="lxr_phone" id="lxr_phone" class="layui-input" value="{$info['lxr_phone'] == ''?'':$info['lxr_phone']}" lay-verify="required|number|phone" maxlength="11"></td>
            </tr>
            <tr class="taxi">
                <td style="text-align: center;">*联系人地址</td>
                <td><input type="text" name="lxr_address" id="lxr_address" class="layui-input" value="{$info['lxr_address'] == ''?'':$info['lxr_address']}" lay-verify="required"></td>
            </tr>
            <tr>
                <td colspan="2">
                    <button class="layui-btn" lay-submit="" lay-filter="submit" id="submits">提交</button>
                </td>
            </tr>
        </table>
    </form>
    <script>
        layui.use(['form','laydate','layer'], function () {
            var form = layui.form
                ,layer = layui.layer
                ,laydate = layui.laydate;

            //常规用法
            laydate.render({
                elem: '#birthday'
            });
            laydate.render({
                elem: '#first_receive_license_date'
            });
            laydate.render({
                elem: '#contract_valid_start'
            });
            laydate.render({
                elem: '#contract_valid_end'
            });
            laydate.render({
                elem: '#issue_date'
            });
            laydate.render({
                elem: '#first_receive_date'
            });
            laydate.render({
                elem: '#certificate_valid_start'
            });
            laydate.render({
                elem: '#certificate_valid_end'
            });
            laydate.render({
                elem: '#register_date'
            });

            $('#submits').click(function (data) {

                var formStr=$("#formId").serialize();
                //序列化中文时之所以乱码是因为.serialize()调用了encodeURLComponent方法将数据编码了
                //原因：.serialize()自动调用了encodeURIComponent方法将数据编码了
                //解决方法：调用decodeURIComponent(XXX,true);将数据解码
                var params = decodeURIComponent(formStr,true); //关键点

                $.post("/admin/Driver/supplement_submits", {
                    data: params
                }, function (res) {
                    if (res.code === 1) {
                        alert(res.msg);
                        window.location.reload();

                         //向java 提交 交通部接口数据
                        ajax_post_java(params);
                    } else {
                        alert(res.msg);
                    }
                },'json');
                return false;
            });
        });

        function ajax_post_java(params) {
            $.post("/admin/Driver/ajax_supplement", {
                data : params
            }, function (res) {
                if (res.code === 1) {
                    console.log(res.msg);
                } else {
                    console.log(res.msg);
                }
            }, 'json');
        }
    </script>
</block>